/* Author: CLR */

import java.util.Calendar;

public class Member implements DataObject {

    private String fullName;
    private String dateOfBirth;
    private String memberType;
    private String gender;
    private boolean paid;
    private String address;
    private String phoneNumber;

    Member(String fullName, String dateOfBirth, String memberType, String gender, boolean paid, String address, String phoneNumber) {

        this.fullName = fullName;
        this.dateOfBirth = dateOfBirth;
        this.memberType = memberType;
        this.gender = gender;
        this.paid = paid;
        this.address = address;
        this.phoneNumber = phoneNumber;
    }
// Authour BWH
//    Member() {
//        this.fullName = "BLANK!";
//        this.dateOfBirth = "BLANK!";
//        this.memberType = "BLANK!";
//        this.gender = "BLANK!";
//        this.paid = true;
//        this.address = "BLANK!";
//        this.phoneNumber = "BLANK!";
//    }

    public String toString() {
        return fullName + ";" + dateOfBirth + ";" + memberType + ";" + gender + ";" + paid + ";" + address + ";" + phoneNumber;
    }

    /*
     * Author: BWH
     */
    //gaar her udfra at en saeson starter 1. Januar.
    public String getAgeGroup() {
        Calendar cal = Calendar.getInstance();
        int year = cal.get(Calendar.YEAR);
        String bday = getDateOfBirth();

        int byear = Integer.parseInt(bday.substring(4, 8));
        int age = year - byear;

        if (age < 18) {
            return "Junior";
        } else if (age > 17 && age < 65) {
            return "Senior";
        } else {
            return "pensionist";
        }
    }

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getDateOfBirth() {
        return dateOfBirth;
    }

    public void setDateOfBirth(String dateOfBirth) {
        this.dateOfBirth = dateOfBirth;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public String getMemberType() {
        return memberType;
    }

    public void setMemberType(String memberType) {
        this.memberType = memberType;
    }

    public boolean isPaid() {
        return paid;
    }

    public void setPaid(boolean paid) {
        this.paid = paid;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }
}